package me.zhengjie.modules.system.service

import jakarta.servlet.http.HttpServletResponse
import me.zhengjie.common.utils.PageResult
import me.zhengjie.modules.system.domain.User
import me.zhengjie.modules.system.service.dto.UserDTO
import me.zhengjie.modules.system.service.dto.UserLoginDTO
import me.zhengjie.modules.system.service.dto.UserQueryCriteria
import org.springframework.data.domain.Pageable
import org.springframework.web.multipart.MultipartFile
import java.io.IOException

/**
 * @author Kuki Wu
 * @date 2024-11-23
 */
interface UserService {
    fun findById(id: Long): UserDTO?
    fun create(resources: User): UserDTO?
    fun update(resources: User)
    fun delete(id: Long)
    fun findByName(userName: String?): UserDTO?
    fun getLoginData(userName: String?): UserLoginDTO?
    fun updatePass(username: String?, encryptPassword: String?)
    fun updateAvatar(file: MultipartFile):Map<String, String>
    fun updateEmail(username: String?, email: String?)
    fun queryAll(criteria: UserQueryCriteria, pageable: Pageable?): PageResult<UserDTO?>?
    fun queryAll(criteria: UserQueryCriteria): List<UserDTO>

    @Throws(IOException::class)
    fun download(queryAll: List<UserDTO>, response: HttpServletResponse?)

    /**
     * 用户自助修改资料
     * @param resources /
     */
    fun updateCenter(resources: User?)

    /**
     * 重置密码
     * @param ids 用户id
     * @param pwd 密码
     */
    fun resetPwd(ids: Set<Long?>?, pwd: String?)
}